package com.cl.receiver;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.cl.service.UpdateWidgetService;

public class MyWidget extends AppWidgetProvider {
	private static final String TAG = "MyWidget";

	@Override
	public void onReceive(Context context, Intent intent) {
		Intent i = new Intent(context,UpdateWidgetService.class);
		context.startService(i);
		super.onReceive(context, intent);
	}

	@Override
	public void onUpdate(Context context, AppWidgetManager appWidgetManager,
			int[] appWidgetIds) {
		// TODO Auto-generated method stub
		super.onUpdate(context, appWidgetManager, appWidgetIds);
	}

	@Override
	public void onEnabled(Context context) {
		Log.i(TAG, "开启更新widget的服务");
		Intent service = new Intent(context,UpdateWidgetService.class);
		context .startService(service);
		super.onEnabled(context);
	}

	@Override
	public void onDisabled(Context context) {
		Log.i(TAG, "关闭更新widget的服务");
		Intent service = new Intent(context,UpdateWidgetService.class);
		context .stopService(service);
		super.onDisabled(context);
	}
	
}
